import db from '../utils/dbconf';
import makeres from '../utils/res';
import TokenTools from './tools/token';
import CodeTools from './tools/code';
import { ParameterError, TargetDataNoneError } from '../utils/classModal';

import { TABLE_NAME as USER_TABLE } from './user';

const banuser = async ({ params: { id, dis } }, res, next) => {
	const i = await db
		.table(USER_TABLE)
		.where({ id, level: ['!=', 999] })
		.update({ dis });
	if (!i) throw new TargetDataNoneError();
	return res.send(makeres.success_mesage('修改成功'));
};
export default {
	banuser,
};
